package com.hs.jhzd.repository;

import com.hs.jhzd.entity.JhScl90JgbEntity;
import com.hs.jhzd.entity.dto.Xljg;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;
import java.util.List;

public interface JhScl90JgbRepository extends JpaRepository<JhScl90JgbEntity, String> {

    @Query("select new com.hs.jhzd.entity.dto.Xljg(u.zybh, u.rybh,a.name, u.qth, u.qt,u.jsbx, u.pz, u.pgmj, u.kssj, u.zfz, u.yy, u.rjgxmg,u.qpzz, u.kb, u.dd, u.jl,u.csjg,u.sjc,u.scbj, u.jsbh, u.jsmc, a.jsh) from JhScl90JgbEntity u left join Prisoner a  on u.rybh=a.rybh where  (:rybh is null or u.rybh=:rybh)  and ( :jsbh is null or u.jsbh=:jsbh) and u.sjc between :startTime and :endTime ")
    List<Xljg> findByZybhAndJshAndSjcBetween(@Param("rybh") String rybh, @Param("jsbh")String jsbh, @Param("startTime")Date startTime, @Param("endTime")Date endTime);
}
